<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" 
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" 
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" 
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" 
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
    <title><fmt:message key="config.changePassword.title" /></title>
</head>
<body>
    <h1><fmt:message key="config.changePassword.title" /></h1>
    
    <c:url var="changePasswordUrl" value="/config/changePassword"/>
    <form:form action="${changePasswordUrl}" id="passwordForm" modelAttribute="passwordForm" method="post">
        <form:errors cssClass="error"/>
        <table>
            <tbody>
                <tr>
                    <th><fmt:message key="config.changePassword.current" /></th>
                    <td>
                        <form:password path="currentPassword"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "currentPassword",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : { 
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="currentPassword"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="config.changePassword.new" /></th>
                    <td>
                        <form:password path="newPassword"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "newPassword",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : { 
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="newPassword"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="config.changePassword.confirm" /></th>
                    <td>
                        <form:password path="confirmNewPassword"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "confirmNewPassword",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : { 
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="confirmNewPassword"/>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td>
                        <div class="buttons">
                            <button id="changePasswordButton" class="ok" type="submit"/><fmt:message key="label.form.submit"/></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'changePasswordButton', 
                                    event:'onclick'
                                }));
                            </script>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>
</body>
